package cn.lcsjsxy.yxz.equalspractice.two;

import cn.lcsjsxy.yxz.polymorphismexercises.geometry.MyRectangle;

public class MyDate {

    private int day;    // 日
    private int month;  // 月
    private int year;   //年

    public int getDay() {
        return day;
    }

    public void setDay(int day) {
        this.day = day;
    }

    public int getMonth() {
        return month;
    }

    public void setMonth(int month) {
        this.month = month;
    }

    public int getYear() {
        return year;
    }

    public void setYear(int year) {
        this.year = year;
    }

    public MyDate(int day, int month, int year) {
        this.day = day;
        this.month = month;
        this.year = year;
    }

    //
    /*@Override
    public boolean equals(Object obj) {
        if (!(obj instanceof MyDate myDate)) return false;
        return day == myDate.day && month == myDate.month && year == myDate.year;*/


    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj instanceof MyDate) {
            MyDate myDate = (MyDate) obj;
            return day == myDate.day && month == myDate.month && year == myDate.year;
        }
        return false;
    }


}

